import { PartFigure } from './PartFigure';
import { Canvas } from './Canvas';
import { PartBase } from '../model/parts/PartBase';
// import { LED as PartLED } from '../store/parts/LED';


const colorList: {[key:string]:string} = {
    "red": "rgb(255,0,0)" ,
    "yellow": "rgb(255,255,0)" ,
    "blue":"rgb(0,0,255)",
    "green": "rgb(0,255,0)" ,
    "white": "#fff" ,
}

export default class LEDFigure extends PartFigure {

    constructor(canvas: Canvas, part: PartBase) {
        super(canvas, part)
        this.setColor(colorList[(part as any).color]||colorList.white)
    }

    setColor(color:string) {
        console.log("setcolor",color)
        this.box.attr({fill: color})
    }
}